package ar.uade.distribuidas.tpo.dba.dominio;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

import ar.uade.distribuidas.tpo.base.dominiodto.ClienteDTO;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "clientes")
public abstract class Cliente {

	@Id
	private long cuil;
	private String nombre;

	public Cliente() {
	}
	
	

	public Cliente(long cuil) {
		super();
		this.cuil = cuil;
	}

	public long getCuil() {
		return cuil;
	}

	public void setCuil(long cuil) {
		this.cuil = cuil;
	}


	

	public Cliente(long cuil, String nombre) {
		super();
		this.cuil = cuil;
		this.nombre = nombre;
	}



	public String getNombre() {
		return nombre;
	}



	public void setNombre(String nombre) {
		this.nombre = nombre;
	}



	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (cuil ^ (cuil >>> 32));
		result = prime * result + ((nombre == null) ? 0 : nombre.hashCode());
		return result;
	}



	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Cliente other = (Cliente) obj;
		if (cuil != other.cuil)
			return false;
		if (nombre == null) {
			if (other.nombre != null)
				return false;
		} else if (!nombre.equals(other.nombre))
			return false;
		return true;
	}



	@Override
	public String toString() {
		return "Cliente [cuil=" + cuil + ", nombre=" + nombre + "]";
	}



	public static Cliente fromDTO(ClienteDTO dto) {
		// TODO Auto-generated method stub
		return null;
	}

	public ClienteDTO toDTO() {
		// TODO Auto-generated method stub
		return null;
	}

}
